package user;

import guiTesting.AddGroup;

import java.awt.HeadlessException;
import java.util.List;

import com.atlassian.crowd.exception.ApplicationPermissionException;
import com.atlassian.crowd.exception.GroupNotFoundException;
import com.atlassian.crowd.exception.InvalidAuthenticationException;
import com.atlassian.crowd.exception.InvalidCredentialException;
import com.atlassian.crowd.exception.InvalidEmailAddressException;
import com.atlassian.crowd.exception.InvalidGroupException;
import com.atlassian.crowd.exception.InvalidUserException;
import com.atlassian.crowd.exception.MembershipNotFoundException;
import com.atlassian.crowd.exception.OperationFailedException;
import com.atlassian.crowd.exception.UserNotFoundException;
import com.atlassian.crowd.integration.rest.entity.PasswordEntity;
import com.atlassian.crowd.model.group.Group;
import com.atlassian.crowd.model.group.GroupType;
import com.atlassian.crowd.model.user.User;

public class AppT {

	/**
	 * @param args
	 * @throws ApplicationPermissionException 
	 * @throws InvalidAuthenticationException 
	 * @throws OperationFailedException 
	 * @throws GroupNotFoundException 
	 * @throws InvalidEmailAddressException 
	 * @throws UserNotFoundException 
	 * @throws InvalidGroupException 
	 * @throws InvalidCredentialException 
	 * @throws InvalidUserException 
	 * @throws HeadlessException 
	 * @throws MembershipNotFoundException 
	 */
	public static void main(String[] args) throws GroupNotFoundException, OperationFailedException, InvalidAuthenticationException, ApplicationPermissionException, InvalidEmailAddressException, UserNotFoundException, InvalidGroupException, HeadlessException, InvalidUserException, InvalidCredentialException, MembershipNotFoundException {
		//ConnectTest nn = new ConnectTest();
		//nn.ConnectTest();

		String test = "sam";

		RetrieveUserInfo u = new RetrieveUserInfo(); 

		//System.out.println( u.getUserInfo(test) + " \n");
		//AdvanceUserInfoRetriever au = new AdvanceUserInfoRetriever();


		u.searchUserInfo(test);
		//System.out.println(u.searchUsers("test"));

		u.getNamesOfGroupsForUser(test);

		//System.out.println(u.getGroupsForUser(test));

		//RetrieveGroupInfo g = new RetrieveGroupInfo(); 

		AddUser a = new AddUser();
		a.removeUserFromCrowd("test.user23");
		
		PasswordEntity k = new  PasswordEntity("testing");
		User b  = 	a.creatUser("test.user23", "testSam", "testing", "samsoni.abraham@bestbuy.com", "testSaM testing", k, true);
		//a.checkIfUserExist(b.getFirstName());
		a.addUsertoGroup(b.getName(), "Deals Near Me");
		
		
		//a.checkIfUserExist("samsoni.abraham");

		//a.removeUserFromCrowd("testprofile1");
		//a.resetPassword("testprofile1");

		a.checkIfGroupExist("bby");
		RetrieveGroupInfo g = new RetrieveGroupInfo();
		//Group k = g.getGroup("BBY");
		//List gl = g.searchGroups("developer (Role)");
		//System.out.println(gl.toArray());

		/*AddGroup ag = new AddGroup();
		GroupType j = null; 
		boolean active = true; 
		Group tg = 	ag.createGroup("testinGroup", "test my rest client", j.GROUP , active);
		ag.removeGroup(tg.getName());
		ag.AddGroup(tg);
		ag.addGroupToBusinessUserGroup(tg.getName());
		ag.addGroupToDeveloperGroup(tg.getName());
		ag.removeGroup(tg.getName());
*/

	}

}
